﻿Imports lbGlobalcom
Public Class fListaUsuariosBD
    Private lUser As String
    Public ReadOnly Property IDUser() As String
        Get
            Return lUser
        End Get
    End Property
    Private Sub LLenaListaUser()
        Try
            lstUsuarios.DataSource = cUsuariosOracle.GetUsuarios
            lstUsuarios.DisplayMember = "USERNAME"
            lstUsuarios.ValueMember = "USERNAME"
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Private Sub fListaUsuariosBD_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            LLenaListaUser()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Private Sub GetUsuarioSelect()
        If lstUsuarios.SelectedValue IsNot Nothing Then
            lUser = lstUsuarios.SelectedValue
            Me.DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub
    Private Sub lstUsuarios_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstUsuarios.DoubleClick
        GetUsuarioSelect()
    End Sub

    Private Sub btnAcepta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAcepta.Click
        GetUsuarioSelect()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

    Private Sub lstUsuarios_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lstUsuarios.KeyDown
        If e.KeyData = Keys.Enter Then
            GetUsuarioSelect()
        End If
    End Sub

End Class